﻿using System.Data;

namespace DAL
{
    public static class DalAssignedAccountLevel1
    {
        private static readonly clsConnect Cls = new clsConnect();
        #region[Get-Data]
        public static DataTable AssignedAccountLevel1Get(string keywords)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@KEYWORDS", keywords);
            return Cls.GetData("sp_tb_AssignedAccountLevel1_Get");
        }
        public static DataTable AssignedAccountLevel1GetEdit(int id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@IDAccountLevel1", id);
            return Cls.GetData("sp_tb_AssignedAccountLevel1_Get_Edit");
        }
        public static DataTable AssignedAccountLevel1GetFillter(int id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Income_Expenditure_Method_ID", id);
            return Cls.GetData("sp_tb_AssignedAccountLevel1_Fillter");
        }
        #endregion

        #region[Insert-Update-Delete]
        public static bool Insert(EtAssignedAccountLevel1 obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Income_Expenditure_Method_ID", obj.Income_Expenditure_Method_ID);
            Cls.AddParameter("@AccountLevel1_Name_Code", obj.AccountLevel1_Name_Code);
            Cls.AddParameter("@AccountLevel1_Name", obj.AccountLevel1_Name);
            Cls.AddParameter("@Note", obj.Note);
            return Cls.ExecuteNonQuery("sp_tb_AssignedAccountLevel1_Get_Insert");
        }
        public static bool Update(EtAssignedAccountLevel1 obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@IDAccountLevel1", obj.IDAccountLevel1);
            Cls.AddParameter("@Income_Expenditure_Method_ID", obj.Income_Expenditure_Method_ID);
            Cls.AddParameter("@AccountLevel1_Name_Code", obj.AccountLevel1_Name_Code);
            Cls.AddParameter("@AccountLevel1_Name", obj.AccountLevel1_Name);
            Cls.AddParameter("@Note", obj.Note);
            return Cls.ExecuteNonQuery("sp_tb_AssignedAccountLevel1_Get_Update");
        }
        public static bool Delete(EtAssignedAccountLevel1 obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@IDAccountLevel1", obj.IDAccountLevel1);
            obj.Msg = Cls.ExecuteNonQueryOutput("sp_tb_AssignedAccountLevel1_Get_Delete", "@MSG");
            return true;
        }
        #endregion
    }

    public class EtAssignedAccountLevel1
    {
        public int IDAccountLevel1 { get; set; }
        public int Income_Expenditure_Method_ID { get; set; }
        public string AccountLevel1_Name_Code { get; set; }
        public string AccountLevel1_Name { get; set; }
        public string Note { get; set; }
        public int Msg { get; set; }
    }
}